home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr48
/
bpwmru.zip
/
OMRULIST.INT
< prev
next >
Wrap
Text File
|
1993-06-04
|
6KB
|
127 lines
{ *************************************************************************** }
{ V I S U A L I M P L E M E N T A T I O N }
{ Part One }
{ Most Recently Used File List }
{ Pascal Version (C)1993 Bobby R. Wallen }
{ *************************************************************************** }
unit OMRUList;
interface
uses WinTypes, Objects;
const
{ Allow for up to nine (9) Remembered Files }
CM_File1 = 5000;
CM_File2 = 5001;
CM_File3 = 5002;
CM_File4 = 5003;
CM_File5 = 5004;
CM_File6 = 5005;
CM_File7 = 5006;
CM_File8 = 5007;
CM_File9 = 5008;
{ Initialized ( Static ) variable/Constants }
nMaxItems : Integer = 5; { Default Number if Items in List }
hMDIWnd : HWND = 0; { MDI Client Window Handle }
DefIni : PChar = 'WIN.INI';
DefKey : PChar = 'files';
cFile : Integer = 0; { Number of remembered files }
cFileList : Integer = 0; { Number of files in FileMenu List }
type
TItemFmt = record
ID : Integer;
Name : PChar;
end;
PMRUItem = ^TMRUItem;
TMRUItem = object( TObject )
ItemName : PChar;
constructor Init( AName: PChar );
destructor Done; virtual;
end;
PMRUList = ^TMRUList;
TMRUList = object( TCollection )
constructor Init(CWnd: HWND; ALimit, ADelta: Integer );
destructor Done; virtual;
procedure AddMRUItem( AWnd: HWND; AName: PChar ); virtual;
procedure DeleteMRUItem( AWnd: HWND; AName: PChar ); virtual;
function GetMRUItem( AnID: Integer; AName: PChar ): Boolean; virtual;
procedure AppendMRUList( AWnd: HWND ); virtual;
procedure UpdateMRUList( AWnd: HWND ); virtual;
procedure LoadMRUList( AWnd: HWND; IniFile, KeyName: PChar ); virtual;
procedure SaveMRUList( IniFile, KeyName: PChar ); virtual;
end;
implementation
(*
===============================================================================
constructor TMRULIst.Init( CWnd: HWND; ALimit, ADelta: Integer );
--> CWnd = Handle to the MDI Client Window if you are using the MDI interface
ALimit = Maximum number of remembered files allowed in File menu list
ADelta = Not used, is set to 0 by the Initialization procedure
===============================================================================
destructor TMRUList.Done
--> Done = Calls the inherited TCollection disposal method and disposes of
all the Items in the List. Be sure to call SaveMRUList before
calling this method.
===============================================================================
procedure TMRUList.AddMRUItem( AWnd: HWND; AName: PChar );
--> AWnd = Handle to the Window which owns the Menu
AName = A null terminated string containing the Filename to add to the
list. This procedure will handle duplicates.
===============================================================================
procedure TMRUList.DeleteMRUItem( AWnd: HWND; AName: PChar );
--> AWnd = Handle to the Window which owns the Menu
AName = A null terminated string containing the Filename to remove from
the list.
===============================================================================
function TMRUList.GetMRUItem( AnID: Integer; AName: PChar ): Boolean;
--> AnID = The MenuID of one of the Files in the Filelist. This will range
from 5000 to 5008 depending on how many Files you allow to be
saved in the list. This unit will handle up to 9 files.
AName = A null terminated string which is used to pass back the Filename
chosen from the Filelist. The memory for this string must have
been allocated before calling this routine or you will have
a GP fault.
===============================================================================
procedure TMRUList.AppendMRUList( AWnd: HWND );
--> This procedure is for use when you change the menu by either SetMenu()
or through WM_MDISETMENU. It should be called immediately after the call
to SetMenu() or after posting the WM_MDISETMENU but before calling
DrawMenuBar().
AWnd = Handle to the window owning the Menu
===============================================================================
procedure TMRUList.UpdateMRUList( AWnd: HWND );
--> AWnd = Handle to the window owning the Menu
This procedure redraws the Menubar to include any additions or deletions
to the FileList. It handles adding and removing the Separators needed.
===============================================================================
procedure TMRUList.LoadMRUList( AWnd: HWND; IniFile, KeyName: PChar );
--> This procedure will load the saved FileList from a given Ini file using
a given key. If IniFile and KeyName are blank strings then the procedure
uses 'WIN.INI' as the IniFile and 'files' as the Keyname.
AWnd = Handle to the Window owning the Menu
IniFile = A null terminated string containing the name of the INI file
to use. This may be left blank, as '', in which case the
Windows win.ini file will be used.
KeyName = A null terminated string containing the Section name to use
when storing or retrieving the list of filenames. This may
also be left blank in which case the default name 'files'
will be used as the Section name.
===============================================================================
procedure TMRUList.SaveMRUList( IniFile, KeyName: PChar );
--> See above for a description of the usage of IniFile and KeyName.
This procedure will write the remembered filenames into an .ini file
of your choice and under a Section key also of your choice.
===============================================================================